/**
 * 
 */
package com.zznode.redsun.smartcrm.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.zznode.csp.domain.basemodel.DomainValue;
import com.zznode.csp.domain.basemodel.UnDeletable;

/**
 * 咨询记录
 * 
 * @author taoping
 * 
 */
@Entity
@Table(name = "b_consult_record")
@DynamicInsert
@DynamicUpdate
public class ConsultRecord extends DomainValue implements UnDeletable {

	private static final long serialVersionUID = 1L;

	@Column(name = "is_deleted")
	private Boolean isDeleted = Boolean.FALSE;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id")
	private Customer customer;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "product_id")
	private Product product;

	@Column(name = "title")
	private String title;

	@Column(name = "content")
	private String content;

	@Column(name = "answer")
	private String answer;

	@Column(name = "create_date")
	private Date createTime;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "create_user")
	private PersonalInfo createUser;

	@Override
	public boolean isDeleted() {
		return null == this.isDeleted ? false : this.isDeleted.booleanValue();
	}

	@Override
	public void markedAsAvailable() {
		this.isDeleted = Boolean.FALSE;
	}

	@Override
	public void markedAsDeleted() {
		this.isDeleted = Boolean.TRUE;
	}

	public Boolean getIsDeleted() {
		return isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public PersonalInfo getCreateUser() {
		return createUser;
	}

	public void setCreateUser(PersonalInfo createUser) {
		this.createUser = createUser;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}
}
